<template>
    <div id='platform'>
		   <div class="first" v-show="show">
		   		<div>
					<h2>授权小程序</h2>
					<h3>
						将微信小程序授权给予点滴时光，快速生成专属小程序，并提交微信
					</h3>
					<ul class="add_applet" style="display:none;">
						<!--<li><span>微信小程序</span><input placeholder="请输入"/></li>
						<li><span>APPID</span><input placeholder="请输入"/></li>-->
						<li><span>商户号</span><input class="appletMerchantId" placeholder="请输入"/></li>
						<li><span>商户key</span><input class="appletApiKey" placeholder="请输入" type='password' /></li>
						<h4><button class="sure">保存</button> <button class="release">发布</button></h4>
					</ul>
					<ul class="applet_list">
						<li>
							1、微信官方规定：用户必须自己进行小程序注册。然后才可以将小程序授权给任意第三方进行设计和代码管理。
						</li>
						<li>
							2、微信官方规定：小程序个人开放的服务类目是有严格规定的，内容不在服务类目中的，是审核不通过的。
							<a style='color: #00e;' target="_blank" href="https://developers.weixin.qq.com/miniprogram/dev/devtools/ext.html">查看详情</a>
						</li>
						<h4><button @click="tiaozhuan()" class='authorize' style="background:#5BC0BF;border:none;padding:10px;margin:30px;border-radius:10px;color:#fff;">已注册微信小程序，直接授权</button><br/><a style='color: #0099FF;' target="_blank" href="https://mp.weixin.qq.com/">未注册小程序账号，去微信注册</a></h4>
					</ul>
				</div>
				<div class="main" style="text-align:left;">
					<div>
						<h3>绑定体验者</h3>
						<p>
							添加体验者后，即可体验未发布的小程序
	如果想查看所有体验者，请到微信公众平台-登录小程序-用户身份中设置，点击这里跳转。
						</p>
						<h4 style="text-align:center;">
                            <button style="background:#5BC0BF;border:none;padding:10px;border-radius:10px;">
                                <a target="_blank" style='color: #fff;' href="https://mp.weixin.qq.com/">添加体验者</a>
                            </button>
                        </h4>
					</div>
				</div>
		  	</div>
		  	<div class="second" v-show="show1">
		  		<div class="top">
					<img :src="head_img" class="head_img" style="width:200px;" />
					<ul>
						<li>小程序名称：<span class="nick_name">{{nick_name}}</span></li>
						<li>小程序介绍：<span class="signature">{{signature}}</span></li>
					</ul>
					<ul>
						<li>注册时间：<span class="date_time">{{create_time}}</span></li>
					</ul>
					<ul>
						<li>主体信息：<span class="principal_name">{{principal_name}}</span></li>
					</ul>
                    <h4 style="text-align:center;margin-top:20px;">
                        <button style="background:#5BC0BF;border:none;padding:10px;border-radius:10px;">
                            <a href="diandianplatform/myMinipro.html?hasMod=hasMod" target="_blank"  style='color: #fff;'>管理我的小程序</a>
                        </button>
                    </h4>
				</div>
		  	</div>
		</div>	
</template>

<script>
  import subTitle from "@/components/subTitle"
  import pagination from "@/components/pagination"
  import mixin from "@/utils/mixin"
  export default {
    name: "comment",
    mixins: [mixin],
    components: {
      subTitle,
      pagination
    },
    data(){
      return{
        tableData: [],
        total : 1,
        goodsName: '',
        userName: '',
        show:true,
        show1:false,
        nick_name : '',
        signature : '',
        principal_name : '',
        head_img : '',
        create_time : ''
      }
    },mounted(){
         this.$http.post('https://wxpro.diandianyuyue.com/useropen/query_auth_module_ids', {
            account : localStorage.userMobile,
            merchant_id: localStorage.merchantId_ID,
        }, {type: 'form'}).then((res) => {
           if(res.result.length > 0  ){
               this.show = false;
               this.show1 = true;
               this.name_list();
            } else {
               this.show = true;
               this.show1 = false;
            }
        })
    },
    methods: {
        tiaozhuan(){
             this.$http.post('https://wxpro.diandianyuyue.com/useropen/authMinPro', {
                module_id : localStorage.moduleId,
                account : localStorage.userMobile,
                merchant_id:localStorage.merchantId_ID,
                remote_url : 'SmallProgram'
            }, {type: 'form'}).then((res) => {
                var newWeb=window.open('_blank');
                newWeb.location= "https://wxpro.diandianyuyue.com/diandianplatform/accountSelect.html?merchantId="+localStorage.merchantId_ID+"&moduleId="+localStorage.moduleId+"&userMobile="+localStorage.userMobile;
            })
          
        },
        name_list(){
            this.$http.post('https://wxpro.diandianyuyue.com/useropen/get_authorizer_info', {
                account : localStorage.userMobile,
	    	    module_id : localStorage.moduleId,
	    	    merchant_id:localStorage.merchantId_ID,
            }, {type: 'form'}).then((res) => {
                this.nick_name =res.result.nick_name;
                this.signature =res.result.signature;
                this.principal_name=res.result.principal_name;
                this.head_img =res.result.head_img;
                this.create_time =res.result.create_time;
            })
        }
      },
  }
</script>

<style scoped lang="scss">
  @import "~@/assets/css/common";
  .first,.second{
      padding-left:30px;
      padding-top:30px;
      width: 577px;
      text-align: center;
  }
  .first{
      h2{
          text-align: left;
      }
      li{
          text-align:left;
      }
      h2,h3{
          margin-top:30px;
          font-weight: normal;
      }
      p{
          margin:30px;
      }
  }
  .second{
      text-align: left;
      li{
            margin-top:20px;
      }
  }
</style>